#include <stdio.h>
int main()
{
    int i, num, aim, count = 0;
    for (i = 1; i < 2021; i++)
    {
        num = i;
        while (num != 0)
        {
            aim = num % 10;
            if (aim == 2)
                count++;
            num = num / 10;
        }
    }
    printf("2 = %d\n", count);
    getchar();
    return 0;
}